package com.ethanzzh.ethanzzh_xdclass.config;


import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Data
@Configuration
@PropertySource(value = "classpath:application.yml")
public class AliyunOSSConfig implements InitializingBean {

    @Value("${aliyun.file.keyid}")
    private String ossKeyId;
    @Value("${aliyun.file.accessKeySecret}")
    private String ossKeySecret;
    @Value("${aliyun.file.endpoint}")
    private String ossEndpoint;
    @Value("${aliyun.file.bucketname}")
    private String ossBucketName;
    @Value("${aliyun.file.host}")
    private String ossFileHost;

    public static String ALIYUN_END_POINT         ;
    public static String ALIYUN_ACCESS_KEY_ID     ;
    public static String ALIYUN_ACCESS_KEY_SECRET ;
    public static String ALIYUN_BUCKET_NAME       ;
    public static String ALIYUN_FILE_HOST         ;


    @Override
    public void afterPropertiesSet() throws Exception {
        ALIYUN_ACCESS_KEY_ID = ossKeyId;
        ALIYUN_ACCESS_KEY_SECRET = ossKeySecret;
        ALIYUN_END_POINT = ossEndpoint;
        ALIYUN_BUCKET_NAME = ossBucketName;
        ALIYUN_FILE_HOST = ossFileHost;

    }
}
